<template>
  <el-dialog
    top="30px"
    width="900px"
    title="质押合同"
    append-to-body
    :close-on-click-modal="false"
    :before-close="beforeClose"
    :visible.sync="visible"
  >
    <el-tabs type="card" v-model="active">
      <el-tab-pane label="股权质押" name="0">
        <stock-edit
          :related-data="relatedData"
          :is-redo="isRedo"
          :form-data="formData"
          :table-id="tableId"
          @success="handleSuccess"
          @close="beforeClose"
        ></stock-edit>
      </el-tab-pane>
      <el-tab-pane label="股金质押" name="3">
        <stock-edit
          :related-data="relatedData"
          gua-method-sub="3"
          :is-redo="isRedo"
          :form-data="formData"
          :table-id="tableId"
          @success="handleSuccess"
          @close="beforeClose"
        ></stock-edit>
      </el-tab-pane>
      <el-tab-pane label="应收账款" name="1">
        <funds-account
          :related-data="relatedData"
          :is-redo="isRedo"
          :form-data="formData"
          :table-id="tableId"
          @success="handleSuccess"
          @close="beforeClose"
        ></funds-account>
      </el-tab-pane>
      <el-tab-pane label="知识产权" name="2">
        <intellectual-edit
          :related-data="relatedData"
          :is-redo="isRedo"
          :form-data="formData"
          :table-id="tableId"
          @success="handleSuccess"
          @close="beforeClose"
        ></intellectual-edit>
      </el-tab-pane>
    </el-tabs>
  </el-dialog>
</template>

<script>
import StockEdit from '@/credit/views/county/unionProvince/components/contractApproveDeploy/pledge/StockEdit'
import FundsAccount from '@/credit/views/county/unionProvince/components/contractApproveDeploy/pledge/FundsAccount'
import IntellectualEdit from '@/credit/views/county/unionProvince/components/contractApproveDeploy/pledge/IntellectualEdit'
export default {
  components: {
    StockEdit,
    FundsAccount,
    IntellectualEdit,
  },
  props: {
    visible: Boolean,
    isRedo: {
      // 是否合同重做，
      type: Boolean,
      default: false,
    },
    tableId: { type: String, default: '' },
    relatedData: {
      type: Object,
      default: () => ({}),
    },
    formData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      active: '0',
    }
  },
  computed: {},
  watch: {
    formData: {
      handler: function () {
        this.active = this.formData.gua_method_sub || '0'
      },
      deep: true,
      immediate: true,
    },
  },
  created() {},
  mounted() {},
  methods: {
    beforeClose() {
      this.$emit('update:visible', false)
    },
    handleSuccess() {
      this.beforeClose()
      this.$emit('success', true)
    },
  },
}
</script>

<style lang="scss" scoped>
.input-td {
  background: #ffffee;
}
</style>
